﻿<%@ Page Language="C#" MasterPageFile="~/default.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
    Inherits="BookNet.Default" Title="Home" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Content" runat="server">
    <br />
    <br />
    <h3>
        Recent Listed</h3>
    <br />
    <asp:ListView ID="ListView1" runat="server" DataKeyNames="BookID" DataSourceID="SqlDataSource1"
        GroupItemCount="5" Style="margin-right: 198px">
        <EmptyItemTemplate>
            <td runat="server" />
        </EmptyItemTemplate>
        <ItemTemplate>
            <td runat="server" style="">
                <table>
                    <tr>
                        <td>
                            <asp:Image ID="Image1" runat="server" ImageUrl='<%# ChooseImage(Eval("CoverImageUrl").ToString()) %>'
                                Width="100" ToolTip='<%# Eval("Title") %>' AlternateText='<%# Eval("Title") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td><a href="BookDetail.aspx?id=<%# Eval("BookID") %>">
                            <asp:Label ID="Label1" runat="server" Text='<%# Eval("Title") %>' />
                            </a>
                        </td>
                    </tr>
                </table>
            </td>
        </ItemTemplate>
        <AlternatingItemTemplate>
            <td runat="server" style="">
                <table>
                    <tr>
                        <td>
                            <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("CoverImageUrl") %>' Width="100"
                                ToolTip='<%# Eval("Title") %>' AlternateText='<%# Eval("Title") %>' />
                        </td>
                    </tr>
                    <tr>
                        <td><a href="BookDetail.aspx?id=<%# Eval("BookID") %>">
                            <asp:Label ID="Label1" runat="server" Text='<%# Eval("Title") %>' /></a>
                        </td>
                    </tr>
                </table>
            </td>
        </AlternatingItemTemplate>
        <EmptyDataTemplate>
            <table runat="server" style="">
                <tr>
                    <td>
                        No data was returned.
                    </td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <LayoutTemplate>
            <table runat="server" width="100%">
                <tr runat="server">
                    <td runat="server">
                        <table id="groupPlaceholderContainer" runat="server" border="0" style="width: 100%;">
                            <tr id="groupPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr runat="server">
                    <td runat="server" style="">
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
        <GroupTemplate>
            <tr id="itemPlaceholderContainer" runat="server">
                <td id="itemPlaceholder" runat="server">
                </td>
            </tr>
        </GroupTemplate>
    </asp:ListView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:booknetConnectionString1 %>"
        SelectCommand="SELECT * FROM [app_Books] ORDER BY [TimeAdded] DESC"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:booknetConnectionString1 %>"
        SelectCommand="SELECT TOP 6 app_UserProfile.Avatar, aspnet_Users.UserId, aspnet_Users.UserName FROM aspnet_Users INNER JOIN aspnet_Membership AS a ON aspnet_Users.UserId = a.UserId INNER JOIN app_UserProfile ON aspnet_Users.UserId = app_UserProfile.UserID ORDER BY a.CreateDate DESC">
    </asp:SqlDataSource>
    <br />
    <br />
    <h3>
        Recent Members</h3>
    <br />
    <asp:ListView ID="ListView2" runat="server" DataSourceID="SqlDataSource3" >
        <ItemTemplate>
            <td runat="server" style="">
                <table>
                    <tr>
                        <td>
                            
                                <asp:Image ID="Image2" runat="server" ImageUrl='images/anonymous.gif' />
                        </td>
                    </tr>
                    <tr>
                        <td><a href="UserDetail.aspx?id=<%# Eval("UserId") %>">
                            <asp:Label ID="Label2" runat="server" Text='<%# Eval("UserName") %>' /></a>
                        </td>
                    </tr>
                </table>
            </td>
        </ItemTemplate>
        <AlternatingItemTemplate>
            <td runat="server" style="">
                <table>
                    <tr>
                        <td>
                            
                                <asp:Image ID="Image2" runat="server" ImageUrl='images/anonymous.gif' />
                        </td>
                    </tr>
                    <tr>
                        <td><a href="UserDetail.aspx?id=<%# Eval("UserId") %>">
                            <asp:Label ID="Label2" runat="server" Text='<%# Eval("UserName") %>' /></a>
                        </td>
                    </tr>
                </table>
            </td>
        </AlternatingItemTemplate>
        <EmptyDataTemplate>
            <table style="width: 100%;">
                <tr>
                    <td>
                        No data was returned.
                    </td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <LayoutTemplate>
            <table runat="server" border="0" style="width: 100%;">
                <tr id="itemPlaceholderContainer" runat="server">
                    <td id="itemPlaceholder" runat="server">
                    </td>
                </tr>
            </table>
            <div style="">
            </div>
        </LayoutTemplate>
    </asp:ListView>
</asp:Content>
